package com.hongxin.nw.netty.model.packing.info;

import com.hongxin.nw.netty.utils.FieldPack;
import com.hongxin.nw.netty.values.TypeIdentif;
import lombok.extern.slf4j.Slf4j;

/**
 * @remark A.27远程终止充电
 * @author: GuoXiaolin
 * @date 2019/5/25 17:09
 * @Version 1.0
 * @Descibe
 */
@Slf4j
public class Csdna1_13 implements IPacking {
    private String co ;//充电设备编号 压缩BCD码	8Byte	充电设备编号
    private String chargeIndex ; //枪口编号
    private String uid;          //用户id;

    public Csdna1_13 setCo(String co) {
        this.co = FieldPack.caseToBCD(co, TypeIdentif.BYTE_CO.getByteLength());
        return this;
    }

    public Csdna1_13 setChargeIndex(String chargeIndex) {
        this.chargeIndex = FieldPack.caseToBin(chargeIndex, TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getByteLength());
        return this;
    }

    public Csdna1_13 setUid(String uid) {
        this.uid = FieldPack.caseToBCD(uid, TypeIdentif.BYTE_USER_ID.getByteLength());
        return this;
    }

    @Override
    public String packing() {
        return this.co + this.chargeIndex + this.uid;
    }

    @Override
    public String toString() {
        return "Csdna1_13{" +
                "co='" + co + '\'' +
                ", chargeIndex='" + chargeIndex + '\'' +
                ", uid='" + uid + '\'' +
                '}';
    }
}
